]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
grabHelper: Drop to the actor clicked on
authorJasper St. Pierre <jstpierre@mecheye.net>
Mon, 26 Nov 2012 19:55:03 +0000 (14:55 -0500)
committerJasper St. Pierre <jstpierre@mecheye.net>
Sat, 8 Dec 2012 00:54:46 +0000 (19:54 -0500)
This is necessary for child popups in menus, e.g. while in a combo box,
clicking outside of the user menu should drop the entire menu, but
clicking on the user menu itself should only drop the combo box.

https://bugzilla.gnome.org/show_bug.cgi?id=689109

js/ui/grabHelper.js

index aacce4334bfbe5d9718dd3d694471bb76550a5ec..b9e661ff4c94d8e6a7fc11bc564bdefd17217601 100644 (file)
@@ -103,6 +103,16 @@ const GrabHelper = new Lang.Class({
         return -1;
     },
 
+    _actorInGrabStack: function(actor) {
+        while (actor) {
+            let idx = this._findStackIndex(actor);
+            if (idx >= 0)
+                return idx;
+            actor = actor.get_parent();
+        }
+        return -1;
+    },
+
     isActorGrabbed: function(actor) {
         return this._findStackIndex(actor) >= 0;
     },
@@ -323,7 +333,8 @@ const GrabHelper = new Lang.Class({
             // which should be a release event.
             if (press)
                 this._ignoreRelease = true;
-            this.ungrab({ actor: this._grabStack[0].actor });
+            let i = this._actorInGrabStack(event.get_source()) + 1;
+            this.ungrab({ actor: this._grabStack[i].actor });
         }
 
         return this._modalCount > 0;